<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
	'id'=>'product-form',
    'type'=>'horizontal',
    'inlineErrors'=>false,
    'enableClientValidation'=>true,
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array('enctype'=>'multipart/form-data')
)); ?>

	<p class="help-block"><?php echo Yii::t('notices','Fields with <span class="required">*</span> are required.'); ?></p>

	<?php echo $form->errorSummary($model); ?>

	<?php echo $form->textFieldRow($model,'code',array('class'=>'span5','maxlength'=>50)); ?>

	<?php echo $form->textFieldRow($model,'name',array('class'=>'span5','maxlength'=>50)); ?>

	<?php echo $form->dropDownListRow($model,'category_id',CHtml::listData(Category::model()->findAll(),'id','name','type.name'),array(
		'class'=>'span5',
		'empty'=>Yii::t('labels','empty')
	)); ?>

	<?php echo $form->textFieldRow($model,'price',array('class'=>'span5')); ?>

	<div class="control-group">
		<?php echo $form->labelEx($model,'images',array('class'=>'control-label')); ?>
		<div class="controls">
			<?php $this->widget('CMultiFileUpload', array(
				'model'=>$model,
				'attribute'=>'images',
				'accept'=>'jpg|jpeg|gif|png',
				'options'=>array(
					/*
					'onFileSelect'=>'function(e, v, m){ alert("onFileSelect - "+v) }',
					'afterFileSelect'=>'function(e, v, m){ alert("afterFileSelect - "+v) }',
					'onFileAppend'=>'function(e, v, m){ alert("onFileAppend - "+v) }',
					'afterFileAppend'=>'function(e, v, m){ alert("afterFileAppend - "+v) }',
					'onFileRemove'=>'function(e, v, m){ alert("onFileRemove - "+v) }',
					'afterFileRemove'=>'function(e, v, m){ alert("afterFileRemove - "+v) }',
					*/
				),
			)); ?>
		</div>
	</div>

	<?php echo $form->dropDownListRow($model,'status',array(1=>'Available',0=>'Unavailable'),array('class'=>'span5')); ?>

	<?php echo $form->textFieldRow($model,'available_sizes',array('class'=>'span5','maxlength'=>50)); ?>

	<?php echo $form->textAreaRow($model,'description',array('rows'=>4, 'cols'=>50, 'class'=>'span5')); ?>

	<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? Yii::t('zii','Create') : Yii::t('zii','Save'),
		)); ?>
	</div>

<?php $this->endWidget(); ?>
